package lcr;

public class Test0018 {
}

class Solution0018_1 {
    public boolean isPalindrome(String s) {
        char[] charArray = s.toCharArray();
        int length = charArray.length, i = 0, j = length - 1;
        while (i < j) {
            while (i < j && !Character.isAlphabetic(charArray[i])&&!Character.isDigit(charArray[i])) i++;
            while (i < j && !Character.isAlphabetic(charArray[j])&&!Character.isDigit(charArray[j])) j--;

            if (Character.toLowerCase(charArray[i]) != Character.toLowerCase(charArray[j])) return false;
            i++;
            j--;
        }
        return true;
    }
}
